﻿#region Legal notice
/*
 * This file is part of EPPLib.
 * Copyright 2010, 2011 
 * Gianluca Esposito (info@gianlucaesposito.it)
 * ----------------------------------------------------------------------------
 * EPPLib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 * 
 * EPPLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Nome-Programma; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#endregion

#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Xml.Serialization;
using System.Text;
using System.Xml;
using System.Xml.Schema;
#endregion

namespace EPPLib.Objects
{
    public class ContactCodeObject : BaseObject
    {
        #region Enums
        public enum ContactTypes
        {
            Admin,
            Tech,
            Undefined
        }
        #endregion

        #region Members
        private string _code;
        private ContactTypes _type;
        #endregion

        #region Properties
        [XmlText]
        public string Code { get { return _code; } set { _code = value; } }

        [XmlIgnore]
        public ContactTypes Type { get { return _type; } set { _type = value; } }

        [XmlAttribute(AttributeName ="type")]
        public string TypeValue
        {
            get
            {
                switch (_type)
                {
                    case ContactTypes.Admin: return "admin";
                    case ContactTypes.Tech: return "tech";
                    default: return string.Empty;
                }
            }
            set { }
        }

        [XmlIgnoreAttribute()]
        public bool TypeValueSpecified { get { return _type != ContactTypes.Undefined; } }
        #endregion

        #region Constructor(s)
        public ContactCodeObject()
        {
            _code = string.Empty;
            _type = ContactTypes.Undefined;
        }
        public ContactCodeObject(string code)
        {
            _code = code;
            _type = ContactTypes.Undefined;
        }
        public ContactCodeObject(string code, ContactTypes type)
        {
            _code = code;
            _type = type;
        }
        #endregion
    }
}